/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package gr.anagnosg.general.utils;

import java.io.File;
import java.io.FilenameFilter;

/**
 *
 * @author anagnosg
 */
public class FileNameContainsFilter  implements FilenameFilter{
    private String filename ;
    private boolean same=false;
         
        public FileNameContainsFilter(String filenamep){
            this.filename = filenamep;
        }
        
        public FileNameContainsFilter(String filenamep,boolean same){
            this.filename = filenamep;
            this.same=same;
        }
        public boolean accept(File dir, String name) {
            boolean output=false;
            if(same){
                output = name.equals(filename);
            }
            else{
                output = name.indexOf(filename)>=0;
            }
                
            return output;
        }
}
